from PyQt5.QtCore import QThread, QSettings, pyqtSignal
from util.Tools import Tools
import requests
settings = QSettings(Tools.resource_path("config\\config.ini"), QSettings.IniFormat)
settings.setIniCodec("UTF-8")



class RequestH(QThread):
    '''
    '''
    al_txt_conent_sig = pyqtSignal(str)
    trow_conment_signal = pyqtSignal(str)

    def __init__(self):
        super().__init__()
        self.Pramer = None
        self.al_txt_conent_sig.connect(self.al_sing)

    def run(self):
        '''
        请求后台接口
        将返回的参数，传入语音与文字框(主函数)
        :return:
        '''
        try:
            decode_ret = "woaini"
            if decode_ret:
                self.trow_conment_signal.emit(decode_ret)
        except Exception:
            print("err")

        pass

    def al_sing(self):
        '''
        发送至语音
        :return:
        '''
        try:
            # ret = requests.post(url=, self.Pramer)
            pass
        except Exception:
            print('err yu yin')
        pass

    def ReceiveEmit(self,rec):
        '''
        接收主进程传来的消息
        :return:
        '''
        self.ReduceEmitDate(rec)

    def ReduceEmitDate(self,rec):
        '''
        处理信息
        :param rec:
        :return:
        '''
        self.Pramer = rec


    def __del__(self):
        self.wait()

